package Cinema.DataLayer;


import org.w3c.dom.Document;
import org.w3c.dom.Element;
import Exceptions.WrongXMLElement;


/**
 * Interface that allows to objects be streamed to/from XML 
 * @author Fuchtzeinsoft Team
 */
public interface IXmlParsable {
	
	/**
	 * converts an object, which implemented this method to an XML element
	 * @param document - the xml document which will store the collected data
	 * @return - xml Element filled with data from calling object 
	 */
	public Element getXml(Document document);
	
	/**
	 * fills the calling object with data, parsed from xml element of initial file
	 * @param xmlElement - the xml element to parse
	 * @throws WrongXMLElement - if the xml element doesn't fit the calling object type
	 */
	public void initFromXml(Element xmlElement) throws WrongXMLElement;
	
	/**
	 * like initFromXml(Element xmlElement), but here we can mention if the system is in init or restoring mode
	 * @param isRestoring - system mode
	 * @param xmlElement the xml element to parse
	 * @throws WrongXMLElement
	 */
	public void initFromXml(boolean isRestoring, Element xmlElement) throws WrongXMLElement;
	
}
